import { create } from 'zustand';

interface StoreType {
  id: string;
  token: string;
  changeId: (newId: string) => void;
  changeToken: (newToken: string) => void;
}

const useUserStore = create<StoreType>((set) => ({
  id: '',
  token: '',
  changeId: (newId: string) => set({ id: newId }),
  changeToken: (newToken: string) => {
    set({ token: newToken });
    localStorage.setItem('token', newToken);
  },
}));

export default useUserStore;
